<template>
  <div class="elec-app drag">
    <frame></frame>
    <div class="elec-app-menu">
      <div class="avatar no-drag">
        <img :src="avatarImgUrl" alt="" />
      </div>
      <div class="elec-app-menu-list">
        <div class="menu-list-top">
          <div
            class="menu-item no-drag"
            v-for="(item, index) in topMenuList"
            :key="index"
            @click="item.func(index)"
          >
            <i
              :class="[
                'iconfont',
                activeIndex == index ? item.activeIcon : item.icon,
                activeIndex == index ? 'active' : ''
              ]"
            ></i>
          </div>
        </div>
        <div class="menu-list-bottom">
          <div class="menu-item no-drag" v-for="(item, index) in bottomMenuList" :key="index">
            <i :class="['iconfont', item.icon]"></i>
          </div>
        </div>
      </div>
    </div>
    <div class="elec-app-main">
      <router-view></router-view>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import frame from '@/components/frame/index.vue'

const avatarImgUrl = ref('https://eryatalk.oss-cn-beijing.aliyuncs.com/logo.jpeg')
const activeIndex = ref(0)
const topMenuList = ref([
  {
    icon: 'icon-xinxi',
    activeIcon: 'icon-xinxifill',
    func: (index) => {
      activeIndex.value = index
    }
  },
  {
    icon: 'icon-tongxunlu1',
    activeIcon: 'icon-tongxunlu1',
    func: (index) => {
      activeIndex.value = index
    }
  },
  {
    icon: 'icon-043lifangti',
    activeIcon: 'icon-043lifangti',
    func: (index) => {
      activeIndex.value = index
    }
  },
  {
    icon: 'icon-wenjianjia',
    func: () => {}
  },
  {
    icon: 'icon-pengyouquan1',
    func: () => {}
  }
])

const bottomMenuList = ref([
  {
    icon: 'icon-xiaochengxu',
    func: () => {}
  },
  {
    icon: 'icon-shouji',
    func: () => {}
  },
  {
    icon: 'icon-caidan1',
    func: () => {}
  }
])
</script>
<style lang="less" scoped>
.elec-app {
  position: relative;
  display: flex;
  height: 100%;
  .elec-app-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 55px;
    background-color: #2e2e2e;
    padding-top: 35px;
    padding-bottom: 10px;
    .avatar {
      cursor: pointer;
      margin-bottom: 18px;
      img {
        height: 37px;
        width: 37px;
      }
    }
    .elec-app-menu-list {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      .menu-list-top,
      .menu-list-bottom {
        display: flex;
        flex-direction: column;
        .menu-item {
          width: 100%;
          height: 40px;
          line-height: 40px;
          text-align: center;
          cursor: pointer;
          i {
            font-size: 22px;
            color: #969696;
            &.active {
              color: #07c160;
            }
          }
        }
      }
    }
  }
  .elec-app-main {
    flex: 1;
  }
}
</style>

<style lang="less">
.elec-app {
  .elec-app-main {
    display: flex;
    height: 100%;
    .elec-app-main-list {
      width: 250px;
      border-right: 1px solid #d6d6d6;
      background-color: #e8e7e6;
    }
    .elec-app-main-detail {
      flex: 1;
      background-color: #f5f5f5;
    }
  }
}
</style>
